home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 12: Textmags & Docs / nf_archive_12.iso / MAGS / SOURCES / ATARI_SRC.ZIP / atari source / AHDI / TTFHDX / LBIGRW.C < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-09  |  1.8 KB  |  93 lines

  1. #include    <osbind.h>
  2. #include    "define.h"
  3.  
  4. main(argc, argv)
  5. int    argc;
  6. char    *argv[];
  7. {
  8.     long        total, bsize, ostack, i;
  9.     register long    start, stop, *hz200v, amtrd;
  10.     unsigned int    fhandle/*, rate*/, j;
  11.     char        fname[128], *rbuf, show[10];
  12.  
  13.  
  14.     if (argc <= 1) {
  15.         strcpy(fname, "N:\\BIGFILE");
  16.     } else {
  17.         strcpy(fname, argv[1]);
  18.     }
  19.     if ((fhandle = Fopen(fname, 0)) < 0) {
  20.         printf("\n\rCannot open %s\!", fname);
  21.         return;
  22.     }
  23.  
  24.     bsize = Malloc(-1L);
  25.     rbuf = (char *)Malloc(bsize);
  26.     total = i = 0L;
  27.     ostack = Super(NULL);
  28.     hz200v = (long *)0x4ba;
  29.     for (j = 0; j < 6; j++) {
  30. timit:
  31.         start = *hz200v;
  32.         amtrd = Fread(fhandle, bsize, rbuf);
  33.         stop = *hz200v;
  34.         if (amtrd < 0) {
  35.             printf("\n\rRead Error\!");
  36.             goto end;
  37.         } else if (amtrd > 0) {
  38.             i += amtrd;
  39.             total += (stop - start);
  40.             goto timit;
  41.         } else /* if (amtrd == 0) */ {
  42.             strcpy(show, "          ");
  43.             ltoa(total, show);
  44.             printf("\n\r\r # 200hz ticks: %s\n\r", show);
  45.             strcpy(show, "          ");
  46.             ltoa(i, show);
  47.             printf("\n\r # bytes read: %s\n\r", show);
  48.             Fseek(0L, fhandle, 0);    /* back to beginning of file */
  49.             total = i = 0L;
  50.         }
  51.     }
  52. end:
  53.     Super(ostack);
  54.     Fclose(fhandle);
  55.     while(!Bconstat(2))
  56.         ;
  57. }
  58.  
  59.  
  60. ltoa(inword, numbuf)            
  61. long inword;
  62. char numbuf[];
  63. {    
  64.     long temp1, value;
  65.     register int i, j;
  66.     char tmpbuf[10];
  67.     register char *ascbuf;
  68.     
  69.     ascbuf = numbuf;
  70.     i = 0;                /* if the value is non zero  */
  71.  
  72.     if (!inword)    
  73.     *ascbuf++ = '0';
  74.     else {
  75.     value = inword;
  76.     while(value) {
  77.         temp1 = value % 10;        /*  find the remainder    */
  78.         temp1 += 0x0030;        /*  convert to ASCII    */
  79.         tmpbuf[i++] = temp1;    /*  buffer is reverse    */
  80.         value = value / 10;
  81.     }
  82.  
  83.     for (j = i-1; j >= 0; j--)     /* reverse it back    */
  84.         *ascbuf++ = tmpbuf[j];
  85.     }
  86.  
  87.     *ascbuf = 0;            /* end of string mark    */
  88.     return;
  89. }
  90.  
  91.  
  92.  
  93.